#include <iostream>
#include <Eigen/Dense>

using namespace Eigen;
using namespace std;

void test01();
void test02();
void test03();
void test04();

int main()
{
	//test01();
	//test02();
	//test03();
	test04();
	return 0;
}

void test04()
{
	Matrix2d a;
	a << 1, 2,
		3, 4;
	MatrixXd b(2, 2);
	b << 2, 3,
		1, 4;
	MatrixXd ccc = a + b;
	cout << "a + b = \n" << a + b << endl;
	cout << "a - b = \n" << a - b << endl;
	std::cout << "Doing a += b;" << std::endl;
	a += b;
	std::cout << "Now a =\n" << a << std::endl;
	Vector3d v(1, 2, 3);
	Vector3d w(1, 0, 0);
	std::cout << "-v + w - v =\n" << -v + w - v << std::endl;
}

void test01()
{
	MatrixXd m(2, 2);
	m(0, 0) = 3;
	m(1, 0) = 2.5;
	m(0, 1) = -1;
	m(1, 1) = m(1, 0) + m(0, 1);
	std::cout << m << std::endl;
}

void test02()
{
	MatrixXd m = MatrixXd::Random(3, 3);
	m = (m + MatrixXd::Constant(3, 3, 1.2)) * 50;
	VectorXd v(3);
	v << 1, 2, 3;
	cout << "\nTest02\nm * v = " << endl << m * v << endl;

}

void test03()
{
	MatrixXd m = Matrix3d::Random();
	m = (m + Matrix3d::Constant(1.2)) * 50;
	VectorXd v(3);
	v << 1, 2, 3;
	cout << "\nTest03\nm * v = " << endl << m * v << endl;

}